<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>

<%@ include file="../general/header.jsp" %>

	<div id="header">${title}</div>
	<%@ include file="../general/menu.jsp" %>
		<div id="content">
		<form:form method="POST" action="${action}" commandName="itemForm" enctype="multipart/form-data">

			<input type="hidden" name="itemid" value="${itemid}" >
			
			<span>Item Name: </span>
			<form:input path="name" /><br />
			<form:errors path="name" />

			<c:if test="${action!='../item/ModifyItems'}">
				<span>Type: </span>
					<form:select path="type">
						<form:option value="normal" label="Normal Sale" />
						<form:option value="auction" label="Auction" />
					</form:select>
				<form:errors path="type" />
			</c:if>
			
			<span>Description: </span>
			<form:input  path="description" /><br />
			<form:errors path="description" />
			
			<span>Price: </span>
			<form:input  path="precio" /><br />
			<form:errors path="precio" />
						
			<span>Stock: </span>
			<form:input path="count" /><br />
			<form:errors path="count" />
			
			<span>Category: </span>
				<form:select path="category">
					<form:options items="${categories}" itemValue="id" itemLabel="name" />
				</form:select>
			<form:errors path="category" />
			
			<span>New Item: </span>
			<form:checkbox path="newItem" /><br />
			<form:errors path="newItem" />
			
			<span>Publish Priority: </span>
			<form:checkbox path="priority" /><br />
			<form:errors path="priority" />
							
			<span>Image: </span>
			<c:if test="${!empty itemImage}">
				<c:if test="${!empty itemImage.data}">
					<img width="50" height="50" src="./getImage?itemid=${itemid}" />
				</c:if>
			</c:if>
			<input type="file" name="image" /><br />
			<form:errors path="image" />
			
			<input type="submit" value="Save" />
		</form:form>
	</div>
	<div id="bottom">
		<span class="inline spaced">
			<a class="color" href="../general/index">Go back to index</a>
		</span>
	</div>
	<%@ include file="../general/footer.jsp" %>